﻿using Iworld.Client.Framework;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Controls.Primitives;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

namespace Iworld.Client
{
    [Iworld.ViewModel.View(Page.游戏主页)]
    public partial class GamePage : UserControl
    {
        public GamePage()
        {
            InitializeComponent();
           this.KeyDown += GamePage_KeyDown;
        }

        void Exe(ICommand com,object obj = null)
        {
            if (com == null) return;
            if (com.CanExecute(obj))
            {
                com.Execute(obj);
            }
        }

        void Bet(ButtonBase btn)
        {
            Exe(btn.Command,btn.CommandParameter);
        }

        void GamePage_KeyDown(object sender, KeyEventArgs e)
        {
            //ModifierKeys keys = Keyboard.Modifiers;
            if (e.Key == Key.A)
            {
                Bet(spade);
            }
            if (e.Key == Key.S)
            {
                Bet(heart);
            }
            if (e.Key == Key.D)
            {
                Bet(club);
            }
            if (e.Key == Key.F)
            {
                Bet(diamond);
            }
            if (e.Key == Key.G)
            {
                Bet(king);
            }
         
        }
    }
}
